﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HybridLab.Workflow.Activities.UI
{
	internal class DeploymentScriptDataGridView : DataGridView
	{
		public override DataObject GetClipboardContent()
		{
			if (base.SelectedCells.Count == 1)
			{
				string selectedText = null;
				if (base.IsCurrentCellInEditMode)
				{
					if (base.EditingControl is TextBox)
					{
						selectedText = (base.EditingControl as TextBox).SelectedText;
					}
					else if (base.EditingControl is ComboBox)
					{
						object selectedItem = (base.EditingControl as ComboBox).SelectedItem;
						if (selectedItem != null)
						{
							selectedText = selectedItem.ToString();
						}
					}
				}
				else if (base.CurrentCell.Value != null)
				{
					selectedText = base.CurrentCell.Value.ToString();
				}
				if (!string.IsNullOrEmpty(selectedText))
				{
					DataObject obj3 = new DataObject();
					obj3.SetData(selectedText);
					return obj3;
				}
			}
			return base.GetClipboardContent();
		}

		protected override bool ProcessDialogKey(Keys keyData)
		{
			if ((keyData == Keys.Escape) && base.IsCurrentCellInEditMode)
			{
				base.ProcessEscapeKey(keyData);
				return true;
			}
			return base.ProcessDialogKey(keyData);
		}
	}
}